﻿using System;

namespace Shape
{
	/// <summary>
	/// Class to serve as ambient context for resolving dependencies
	/// </summary>
	public abstract class DependencyResolver
	{
		private static IDependencyResolver _internalResolver = new DefaultDependencyResolver();
		private static IDependencyResolver _currentResolver = new DefaultDependencyResolver();

		/// <summary>
		/// 
		/// </summary>
		public static IDependencyResolver Current
		{
			get { return _currentResolver; }
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="resolver"></param>
		public static void SetResolver(IDependencyResolver resolver)
		{
			if (resolver == null)
			{
				throw new ArgumentNullException("resolver");
			}

			_currentResolver = resolver;
		}
	
		/// <summary>
		/// 
		/// </summary>
		internal static IDependencyResolver InternalResolver
		{
			get { return _internalResolver; }
		}
	}
}
